﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Obligatorio2013.Modelo;

namespace Obligatorio2013.Pages
{
    public partial class CategoryList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if ((bool)Session["logged"] == true)
            {
                if (!Page.IsPostBack)
                {
                    if (Session["controller"] == null)
                    {
                        Session["controller"] = Sistema.Instance;

                    }

                    Sistema controller = Session["controller"] as Sistema;
                    this.gvCategory.DataSource = controller.getCategories();
                    this.gvCategory.DataBind();

                }

            }
            else
            {
                Response.Redirect("~/Pages/Private/LoginForm.aspx");
            }
        }
    }
}